package com.next

class Product
{
    String name

    Boolean active = true
    ProductCategory category

    ProductType type

    String introduction
    String applicationUrl

    Double loanToValue = 0
    //贷款成数

    Date createdDate = new Date()
    Date modifiedDate = new Date()

    static constraints = {
        name maxSize: 32, unique: true
        active nullable: true
        type nullable: true, blank: true
        introduction type: "text", nullable: true, blank: true
        applicationUrl url: true, maxSize: 512, nullable: true, blank: true
        loanToValue nullable: true, blank: true
    }

    def beforeUpdate()
    {
        modifiedDate = new Date()
    }

    String toString()
    {
        name
    }
}
